<style>
    @media screen and (max-width: 500px) {
        .layui-layer.layui-layer-page {
            width: 100% !important;
            overflow-x: scroll !important;
            left: 0 !important;
        }
        .layui-layer-title {
            width: 100% !important;
            box-sizing: border-box;
        }
        .layui-layer-content {
            width: 100% !important;
        }
    }
</style>
<form class="layui-form seller-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">时间范围：</label>
            <div class="layui-input-inline seller-inline-3">
                <input class="layui-input" autocomplete="off" placeholder="开始日期" name="start" id="start">
            </div>
            <div class="layui-input-inline seller-inline-3">
                <input class="layui-input" autocomplete="off" placeholder="截止日期" name="end" id="end">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">关键字：</label>
            <div class="layui-input-inline seller-inline-3">
                <input type="text" name="search" lay-verify="title" placeholder="UID" autocomplete="off"
                    class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <button class="layui-btn layui-btn-sm" lay-submit lay-filter="user-search"><i
                    class="iconfont icon-chaxun"></i>筛选</button>
        </div>
    </div>
</form>

<div class="table-body">
    <table id="userTable" lay-filter="test"></table>
</div>



<script src="__STATIC_JS__jquery.form.js" type="text/javascript" charset="utf-8"></script>
<script>
    var table, window_box;
    layui.use(['form', 'layedit', 'laydate', 'table','util'], function () {
    	var util=layui.util,table=layui.table,laydate=layui.laydate;
            layui.table.render({
            elem: '#userTable',
            page: true,
            method:'post',
            url: "{:url('room')}",
            id: 'userTable',
            cols: [[
                { field: 'id', title: 'ID', width:80 , align: 'center'},
                { field: '', title: '用户昵称', width: 150 , align: 'center',templet:function(d){
                    if(d.user){
                        return d.user.nickname;
                    }
                    
                }},
                { field: '', title: '商品分类', width: 150, align: 'center',templet:function(d){
                    if(d.goodcat){
                        return d.goodcat.name;
                    }
                    
                }},
                { field: '', title: '地区', width: 150, align: 'center',templet:function(d){
                    if(d.area){
                        return d.area.name;
                    }
                    
                }},
                { field: 'cover', title: '封面', width: 120, align: 'center',templet:function(d){
                	return "<a href='"+d.cover+"' target='_blank'><img src='"+d.cover+"'></a>";
                }},
                { field: 'views', title: '观看', width: 120, align: 'center'},
                { field: 'zans', title: '点赞', width: 120, align: 'center'},
                { field: 'is_live', title: '直播状态', width: 120, align: 'center',templet:function(d){
                    if(d.is_live==0){
                        return '回放';
                    }else{
                       return '直播'; 
                    }
                }},
                { field: 'g_nums', title: '关注', width: 120, align: 'center'},
                { field: 'shares', title: '分享', width: 120, align: 'center'},
                { field: 'ctime', title: '创建时间', width: 180, align: 'center',templet:function(d){
                	return util.toDateString(d.ctime*1000);
                }},
                {field: 'utime', title: '开播时间', width: 180, align: 'center',templet:function(d){
                	if(d.utime){
                		return util.toDateString(d.utime*1000);
                	}
                }},
            ]]
        });
        //搜索
        layui.form.on('submit(user-search)', function (data) {
            layui.table.reload('userTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        table.on('tool(test)', function(obj){
        	var wn=$(this);

        });
        laydate.render({
            elem:'#start',
            type:'datetime'
        });
        laydate.render({
            elem: '#end',
            type:'datetime'
        });
    });
</script>